package com.cole.gx095.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "purchasebill")
public class Purchasebill {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "Id")
    private int id;
    @Basic
    @Column(name = "BillNum")
    private String billNum;
    @Basic
    @Column(name = "BillDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date billDate;
    @Basic
    @Column(name = "ContractId")
    private Integer contractId;
    @Basic
    @Column(name = "ContractNum")
    private String contractNum;
    @Basic
    @Column(name = "BillType")
    private String billType;
    /**
     * 发票金额
     */
    @Basic
    @Column(name = "BillAccount")
    private Double billAccount;
    @Basic
    @CreatedDate
    @Column(name = "CreateDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDate;
    @Basic
    @Column(name = "AttachCount")
    private Integer attachCount;
    @Basic
    @Column(name = "UpdateCount")
    private Integer updateCount;
    @Basic
    @Column(name = "CreateAdminTrueName")
    private String createAdminTrueName;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getBillNum() {
        return billNum;
    }

    public void setBillNum(String billNum) {
        this.billNum = billNum;
    }

    public Integer getContractId() {
        return contractId;
    }

    public void setContractId(Integer contractId) {
        this.contractId = contractId;
    }

    public String getContractNum() {
        return contractNum;
    }

    public void setContractNum(String contractNum) {
        this.contractNum = contractNum;
    }

    public String getBillType() {
        return billType;
    }

    public void setBillType(String billType) {
        this.billType = billType;
    }

    public Double getBillAccount() {
        return billAccount;
    }

    public void setBillAccount(Double billAccount) {
        this.billAccount = billAccount;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Integer getAttachCount() {
        return attachCount;
    }

    public void setAttachCount(Integer attachCount) {
        this.attachCount = attachCount;
    }

    public Integer getUpdateCount() {
        return updateCount;
    }

    public void setUpdateCount(Integer updateCount) {
        this.updateCount = updateCount;
    }

    public String getCreateAdminTrueName() {
        return createAdminTrueName;
    }

    public void setCreateAdminTrueName(String createAdminTrueName) {
        this.createAdminTrueName = createAdminTrueName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Purchasebill that = (Purchasebill) o;
        return id == that.id && Objects.equals(billNum, that.billNum) && Objects.equals(contractId, that.contractId) && Objects.equals(contractNum, that.contractNum) && Objects.equals(billType, that.billType) && Objects.equals(billAccount, that.billAccount) && Objects.equals(createDate, that.createDate) && Objects.equals(attachCount, that.attachCount) && Objects.equals(updateCount, that.updateCount) && Objects.equals(createAdminTrueName, that.createAdminTrueName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, billNum, contractId, contractNum, billType, billAccount, createDate, attachCount, updateCount, createAdminTrueName);
    }
}
